package com.liu.voluntary.util;

import org.json.JSONObject;

public class SexJson {


    public static String  sexJsonToNum(String json){

        JSONObject jsonObject = new JSONObject(json);

        // 检查状态是否为成功
        int status = jsonObject.getInt("status");
        if (status == 0) { // 请求成功
            JSONObject result = jsonObject.getJSONObject("result");
            JSONObject location = result.getJSONObject("location");

            double longitude = location.getDouble("lng");
            double latitude = location.getDouble("lat");

//            System.out.println("Longitude: " + longitude);
//            System.out.println("Latitude: " + latitude);

            return longitude+","+latitude;


        } else {
            System.out.println("Error: Request failed with status " + status);
        }

return null;

    }


}
